<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class AdminRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
        'username' => 'required|unique:project_admin_user',
        'password' => 'required',
        'repassword' => 'required|same:password',
        'email' => 'required|email',
      ];

    }


    /**
     * 获取已定义验证规则的错误消息。
     */
    public function messages()
    {
        return [
            'username.required' => '用户名不能为空',
            'username.unique' => '用户名已存在',
            'password.required'  => '密码不能为空',
             'repassword.required' =>'确认密码不能为空',
            'repassword.same' => '两次密码不一致',
            'email.required' => '邮箱不能为空',
            'email.email' => '邮箱格式不正确',
        ];
    }








}
